<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <!DOCTYPE html>
        <div class="layui-container">
            <div class="layui-row">
                <div class="layui-col-lg-offset3 layui-col-lg6" style="margin-top:50px">
                    <div margin-left="-360px">
                        <button type="button" class="layui-btn" id="test1">
                        <i class="layui-icon">&#xe655;</i>上传Excel数据
                    </button></div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../../lib/layui-v2.6.3/layui.js"></script>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,accept:'file'
            ,url: 'batchadd' //上传接口
            ,done: function(res){
                //上传完毕回调
                if(res.code==200){
                    layer.msg("上传成功")
                }else{
                    layer.msg("上传失败")
                }
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>
</html>